home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
stevi69x.zip
/
SETENV.DOC
< prev
next >
Wrap
Text File
|
1990-04-24
|
2KB
|
57 lines
A program for adding or changing environment variable values for MSDOS.
The "set" command provided by command.com is very limited. It fails to
provide the ability to use quotation marks and escape characters and
octal/hex constants in the value definition. Setenv provides these
abilities.
Usage notes:
setenv <symbol> = <value>
<symbol> ::= legal MSDOS environment symbol. Lower case converted
to uppercase.
<value> ::= environment symbol value in one of three forms:
* No quotation marks. The value is the literal string
of characters starting IMMEDIATELY after the equal
sign and extending to the end-of-line.
* Single quotation marks ('). The value is the literal
string enclosed in quotation marks.
* Double quotation marks ("). The value is the string
enclosed in double quotation marks. Backslash escape
constructions are processed -- this includes the usual
C language constructions such as \n for newline and
\r for carriage return plus octal and hexadecimal
constants (\ddd & \0xdd, respectively).
Based on a program by Alan J Myrvold (ajmyrvold@violet.waterloo.edu)
WARNING WARNING WARNING - virtually no error checking is done !!
use at own risk !!
This program by Larry A. Shurr (las@cbema.ATT.COM)
I added checking for env seg overrun, so now it's a little more robust.
Notes by Alan J Myrgold:
Technical information : A program's PSP contains a pointer at
offset 44 (decimal) to a COPY of the parent's environment.
The environment is a set of strings of the form NAME=value,
each terminated by a NULL byte.
An additional NULL byte marks the end of the environment.
The environment area is ALWAYS paragraph aligned
i.e. on a 16 byte boundary.
Searching backwards from the PSP, I consistently find
two copies of the envronment area.
The program : finds the two areas
reads one into memory
updates the specified environment variable
writes updated environment to parent environment